<script>
    // 创建promise对象
    var promiseObj = new Promise(function(resolve, reject) {
        // 2. 调用resolve把成功的数据存储到promise对象里
        resolve(222);
    });

    console.log('promiseObj', promiseObj);


    console.log('\n-----------------------')

    // 创建promise对象
    var promiseObj2 = new Promise(function(resolve, reject) {
        // 2. 调用reject把失败的数据存储到promise对象里
        reject('失败了');
    });

    console.log('promiseObj2', promiseObj2);

    console.log('\n-----------------------')

    // 创建promise对象
    var flag = false;
    var promiseObj3 = new Promise(function(resolve, reject) {
        if (flag) {
            resolve(222);
        } else {
            reject('失败了');
        }
    });

    console.log('promiseObj3', promiseObj3);
</script>